Would you like to remove the book mark or change the title for this page?
<Untitled>
AddBookMark
nomark
bookmarks
Please enter the reference information for the book mark
bookMarks
bookmarks
refInfo
Book Marks in this book have become corrupted. They are being removed
BookMark
w, "X
,&H.&
V, #>
.', "
removeBookMark
tmplttool
!MpopMenu
bookmarks
gotoBookMark
TutorialList
ChangeTutorial
Notepad
Notepad
popHelp
false
popupHelp
popupHelp
updateDisplay
reader
popHelpText
statusText
s_TargetWindow
popHelp
showText
statusBar
mouseEnter
lscreenFromPage
popHelp
pophelpText
PopHelp
popText
s_targetWindow
pophelp
PupDateDisplay
showText
PopText
showText
popText
mouseLeave
.'+ +F
PupdateDisplay
enterPage
leavePage
reader
e+lockedInPlace
moved
5(gettickCount
5(getTickCount
littlePause
.', "
Ytbk_GlobalLock
Failed allocating memory.
memFlag
retval
tbk_GlobalAlloc
tbk_getWinPointer
tbk_GlobalUnlock
tbk_GlobalHandle
Ttbk_GlobalFree
tbk_freeWinPointer
popupText
[[popText
{popTitle
buttonClick
selectChange newDrive
checkLinks
= TRUE
drive =
setCurrentDrive(
setCurrentDirectory(
;&":")
updateDirectoryInfo
Y&":.\"
updateFileInfo
s&":.\"
selectFile
&":.\"
= FALSE
uncheckLinks
enterDropdown
odropDownItems
getDriveList()
notifyBefore
ZSTRING fileList
linkDLL systoolBookDirectory & "tb40dos.dll"
bgetCurrentDrive()
INT
unlinkDLL
try & "
notifyAfter
--stub
prevent
& handlers
message exist
pathAndFile
checkLinks
drive = getCurrentDrive()
setCurrentDirectory(
.&":.\"&
path = getCurrentDirectory(
updateFileInfo
l&":.\"
selectFile
&":.\"
updateDirectoryInfo
&":.\"
oselectedTextlines
qrefCount
DLLs requires leaving clean
uncheckLinks
notifyBefore
ZSTRING fileList
= getDirectoryOnlyList(
&"*", "N")
B = "."&CRLF&".."
linkDLL systoolBookDirectory & "tb40dos.dll"
INT
unlinkDLL
pry & "
notifyAfter
--stub
prevent
no notifyhandlers
message exist
pathAndFile
keep
causing ES
--{Using Windows pointers}
-- the link statements
needed functions below
linkMemFunctions
linkDLL "KERNEL"
WORD GlobalAlloc(
,DWORD)
Free(
'Handle(
POINTER GlobalLock(
NUnlock(
getWinPointer nSize
ghMem
ZretValue
freeWinPointer pMem
O = GlobalHandle(
c = GlobalUnlock(
GlobalFree(
buttonClick
ZlpMem,temp
--Call
handler
memory allocation
linkmemFunctions
toolBook
allocate
--some
Allocate enough
hold 5 integers.
--Since
2 we
O10 bytes.
(200)
--since
each
rea grows
-- 2
zwe store.
--Set
so on.
.(I*2,lpmem)
"The total
--Intilization handlers
the startup up
enterApplication
4popHelp
popupHelp
initialize
TutorialtoolBar
statusControls
autoSize
maximumSize
`= 640,480
sysPageUnitsPerPixel < 15
sizetoPage
Added 5/13 Rob
|= TRUE
sysReaderRightClick =
systoolBookDirectory&"tb40win.dll"
STRING getIniVar(
setIniVar(String,
INT popMenu(WORD,
Text(
~screenFromPage(
clientFromPage(
ScreenFromClient(
xUnitsFromPixels(
yUnitsFromPixels(
linkdLL "user"
LockWindowUpdate(
getDesktopWindow()
flashWindow(
DWORD GetTickCount()
linkDLL kernel
(tbk_GlobalAlloc =
POINTER tbk_GlobalLock =
tbk_GlobalUnlock =
tbk_GlobalFree =
tbk_GlobalHandle =
path
8<> "\"
autosize
--Handlers
Items
enterMenu menuName, menuAlias
normalGraphic
B"AddBookMark"
"tmplttool"= icon "mark"
setMenuItemName("
9, "Remove
menuItemChecked(
cView
close
updateDisplay
"Tmplttool"
postit
J"Postit1" = ""
"postit1"
/= 1440,1440
J"Postit2" = ""
"postit2"
/= 1540,1540
J"Postit3" = ""
"postit3"
/= 1640,1640
J"Postit4" = ""
"postit4"
/= 1740,1740
Request "Sorry only four
notes per
bookMarks
_Would you like
change
title
"Change"
"Cancel"
answer =
(bookmarks
foundRef = i
("Please
reference information
refInfo
"<Untitled>"
8&","&
nomark"
8have become corrupted.
They are being removed"
&","&
JTextLine
&","&
gotoBookMark
Zlv_menuItems, lv_position
lv_Position
B"removeBookMark"
)&","&
/ 2)
lv_MenuItems =
popText("","There
windowHandle
J",pageScroll
ChangeTutorial
xisOpen
"TutorialList"
%modal
Notepad
--Other
--Traps The message so no error Occurs
there
Status bar control
pophelp.
4s_TargetWindow
4logical
ZoldCursor
statusBar = "
statusText
popHelpText
s_targetWindow =
showText
"PopHelp"
pophelpText
%notActive
upDateDisplay
parentWindow
xPos = (
>/2))
yPos = (
"PopText"=
b&","&
Viewer "
--Updated
JButtons.
J" =
--Keep
Haccident
lockedInPlace
--This creates a friendly
useful
making automatic sequences.
littlePause
ZstartTime
= getTickCount()
cgettickCount() -
0 < 400
mmYield
-- returns a
nSize
tbk_getWinPointer
memFlag = 66
ZretValue
"Failed allocating memory."
retval =
-- unlocks
frees
supplied.
tbk_freeWinPointer pMem
-- extract
low order
Hmasking
f0x0000FFFF
bitAnd 0
's up
assigned
buttonClick
popupText
><> NULL
popTitle
>, mousePosition
)'6'0)56)>)5'0'68)>>+))7)7+>+>771+>'771)7+
optimize
scroll up
scroll down
set scroll
content text
buttonClick
buttonStillDown
content text
enterPage
content text
reader
buttonClick
J"content
" <> 0
" - 1
enabled
B"down"
textUnderFlow
" = 0
notifyBefore
" = 0
" = 0
content text
buttonClick
buttonStillDown
content text
enterPage
content text
reader
buttonClick
textOverFlow
J"content
" = 0
enabled
" + 1
B"up"
notifyAfter
" = 0
" = 0
leavePage
reader
notifyAfter
) = 0
notifyBefore
) = 0
info_LastSavedBy
<BookPath>
:HDMEDIAPATH
Arial
Arial
D:\MTB40\TIPS\WIP\
Arial
System
mes New Roman
mes New Roman
mes New Roman
Times New Roman
Arial
Arial
Times New Roman
D:\SAMPAPPS\
Arial
D:\SAMPAPPS\ARNOLD\
mes New Roman
Times New Roman
Arial
D:\SAMPAPPS\D
D:\SAMPAPPS\D
* , . 0 2 4
Arial
autoSaveAutomatic
info_LastSaved
5/23/95 9:23:39 PM
System
Arial
Arial
Arial
Arial
D:\SAMPAPPS\
purpose
bookmarks
BridieS
Arial
F v .
D:\SAMPAPPS\
MTBWidgets
content text
MS Sans Serif
@80*x<
urier
mes New Roman
olBook Design
page 1
Example
The Right Way
Page "badPage"
poptext
Page "popHelp"
Notepad
Note Pad
Page "Notepad"
TutorialList
Select Tutorial To View
Page "TutorialList"
Page "TmpltTool"
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
sabled
Extending ToolBook
ButtonDoubleClick
ButtonDoubleClick
isOpen
Viewer "Tool"
tile
captionBar
defaulttype
V = "child"
= thin
= popup
sabled
ButtonDoubleClick
ButtonDoubleClick
isOpen
Viewer "
tile
J" =
J" =
captionBar
J" =
defaulttype
J" = "child"
J" =
J" = thin
J" = popup
10,14
selectChars
1728,-22624
Postit4
1640,-22712
Postit3
1440,29190
Postit1
1540,-22812
Postit2
ASYM_BeenHere
title
Extending ToolBook with DLLs and the Windows API
selfRef
enterpage
notifyBefore
selfRef
Learn how to take advantage of some of the more advanced features ToolBook has to offer. The books in the Tips from the pros section are designed for users who have completed the ToolBook Tutorial and have a basic knowledge of ToolBook..
enterpage
1728,-22768
950509195345385869048971625
ASYM_TpID
Extending ToolBook
title
Postit4
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit4
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit4"
585,90
offset
Postit4
3postit4
3Postit4
EnterPage
3Postit4
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit4
= Postit4
textUnderFlow
Forward
Postit3
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit3
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit3"
520,55
offset
Postit3
%3Postit3
%3postit3
EnterPage
&3Postit3
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit3
= Postit3
textUnderFlow
Postit2
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit2
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit2"
800,140
offset
Postit2
2postit2
2Postit2
EnterPage
2Postit2
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit2
= Postit2
textUnderFlow
Postit1
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit1
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit1"
915,105
offset
Postit1
]2Postit1
]2postit1
EnterPage
^2Postit1
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit1
= Postit1
textUnderFlow
notes
EnterPage
notes
UpdateDisplay
notifyAfter EnterPage
MainWindow
notes
enabled
notifyBefore UpdateDisplay
EnterPage
leavePage
UpdateDisplay
EnterPage
Table of Contents
.'+ +F
Hotword
buttonClick
buttonClick
1728,19712
Postit4
Postit3
1540,19668
Postit1
1640,19768
Postit2
ASYM_BeenHere
Table of contents
title
Section List
What are DLLs?
When do you use DLLs?
What does it mean to link a DLL?
use DLLs
Section List
ToolBook system DLLs
Add-on DLLsk
Section List
LinkDLL control structure
Aliasing DLL functions
Unlinking DLLs
Windows v. OpenScript data types
Reference v. value
Pointer referencing
Common problemsssss
Section List
Getting Started
Section List
What DLLs Does ToolBook Use?
Section List
Using DLLs in ToolBookkkkkkkkkk
Section List
Definition
Using the Windows API
Using pointers to structuresssss and structures
Section List
What is the Windows API
Section List
Using translateWindowMessage
Section List
What is it for?
Things to watch for
1440,-10246
1728,19856
What are DLLs?
What are DLLs?
title
4380,3936
Postit4
4380,4080
Postit2
1540,3700
Postit3
1640,3800
Postit1
Windows' main component is an advanced dynamic link library (DLL) system. DLL files are compiled executable code that can be linked to an application at runtime. A DLL provides a set of functions to a program by exporting them to other programs. ToolBook and other Windows applications can link to these DLLs to add functionality they do not have. One advantage of DLLs is that if a program isn't using the DLL, Windows can discard it and free up the memory used by the DLL for other purposes. When the program needs the DLL again, Windows reloads it. it.ds the DLL again, Windows reloads it..............
= DLLibrary
DLLs added from OpenScript.
ToolBooks DLLs for the system.
The System
The Book
1440,3840
95050919535738599103127501459
ASYM_TpID
Getting Started
title
content text
Postit1
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit1
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit1"
480,90
offset
Postit1
]2Postit1
]2postit1
EnterPage
^2Postit1
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit1
= Postit1
textUnderFlow
Postit2
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit2
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit2"
935,110
offset
Postit2
2postit2
2Postit2
EnterPage
2Postit2
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit2
= Postit2
textUnderFlow
Postit3
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit3
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit3"
745,40
offset
Postit3
%3Postit3
%3postit3
EnterPage
&3Postit3
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit3
= Postit3
textUnderFlow
Postit4
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit4
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit4"
(&:&{
720,105
offset
Postit4
3postit4
3Postit4
EnterPage
3Postit4
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit4
= Postit4
textUnderFlow
Forward
EnterPage
leavePage
reader
EnterPage
reader
leavePage
notes
EnterPage
notes
UpdateDisplay
notifyAfter EnterPage
MainWindow
notes
enabled
notifyBefore UpdateDisplay
UpdateDisplay
When do you
When do you use DLLs?
title
2550,2687
Postit4
415,717
Postit2
5300,787
Postit3
1440,-12346
Postit1
Because DLLs provide functions for ToolBook, they can be used to extend ToolBook's functionality. There are three main reasons to use DLLs:
To add functionality that ToolBook
doesn't have. For example, getting
a list of the files in a directory
GetFileOnlyList() from
TB40DOS.DLL.)
To speed up an operation. For
example, sorting textlines
(SortTextLines() from
TB40DLG.DLL.)
To access another programs data
files. For example, read and write
data to Paradox database files
(TB40PDX.DLL.)))
file list
jupdateFileInfo
enterPage
jupdateFileInfo
activateInstance
fileList
getFileOnlyList
uncheckLinks
updateFileInfo
tb40dos.dll
getFileOnlyList
getCurrentDrive
getCurrentDirectory
checkLinks
tb40do.dll
uncheckLinks
notifyAfter
updateFileInfo
"activateInstance
notifyBefore
; path, file
checkLinks
"*.*"
fileList = getFileOnlyList(
N, "", "N")
uncheckLinks
linkDLL systoolBookDirectory & "tb40dos.dll"
STRING
getCurrentDrive()
*getCurrentDirectory(
unlinkDLL
ry & "
file list
tbk_wid_name
1.BMP
2.BMP
3.BMP
4.BMP
5.BMP
BULLET.BMP
DESIGN.TBK
DESIGN10.TBK
DESIGN11.TBK
DESIGN12.TBK
DESIGN13.TBK
DESIGN2.TBK
DESIGN3.TBK
DESIGN4.TBK
DESIGN5.TBK
DESIGN6.TBK
DESIGN7.TBK
DESIGN8.TBK
DESIGN9.TBK
DLLS2.TBK
DLLS3.TBK
DLLS4.TBK
DLLS5.TBK
DLLS6.TBK
MARK.ICO
OPTIMIZ.PALBMP
BULLET.SCN
BULLETSM.BMP
BUTTON.BMP
CLIPBORD.ICO
CONTENTS.ICO
CTL3DV2.DLL
DAVE.TBK
DAVETEMP.TBK
DESIGN.TBK
DESIGN10.TBK
DESIGN11.TBK
DESIGN12.TBK
DESIGN13.TBK
DESIGN14.TBK
DESIGN15.TBK
DESIGN16.TBK
DESIGN17.TBK
DESIGN18.TBK
DESIGN19.TBK
DESIGN2.TBK
DESIGN20.TBK
DESIGN21.TBK
DESIGN3.TBK
DESIGN4.TBK
DESIGN5.TBK
DESIGN6.TBK
DESIGN7.TBK
DESIGN8.TBK
DESIGN9.TBK
DLL2.TBK
DLL3.TBK
DLL4.TBK
DLL5.TBK
DLLCONT.DOC
DLLSPEC1.DOC
FRCTBBLE.BMP
GO.ICO
GROUP.BMP
GROUPCHR.BMP
HEIR.BMP
HEIR.SCN
HEIR2.BMP
HEIR3.BMP
HEIRCHR.BMP
MARK.ICO
NERD.ICO
NOMARK.ICO
OLDHEIR.LOG
OLDHEIR.OLD
OLDHEIR.TBK
PORCHE.SCN
PORSHE.BMP
POSTIT.ICO
ROBTEMP.TBK
ROBTEMP2.TBK
SBOOK.ICO
SBOOKMRK.ICO
SCLIPBRD.ICO
SMARK.ICO
SNOMARK.ICO
SPEC1.DOC
SPOSTIT.ICO
STAR.BMP
STAR.SCN
STOP.ICO
SYSTEM.ICO
SYSTEM2.BMP
SYSTEMP.BMP
SYSTEMP2.BMP
TEST1.TBK
VIEWER.ICOHLP
WRKBNCHT.DLL
MTB30ANM.SBK
MTB30BAS.DLL
MTB30BAS.MAP
MTB30BIT.AMH
MTB30BMP.DLL
MTB30BMP.MAP
MTB30CBT.DLL
MTB30CMP.DLL
MTB30CVT.DLL
MTB30CVT.MAP
MTB30EDT.DLL
MTB30FLT.DLL
MTB30LNL.DLL
MTB30MM.DLL
MTB30MM.INI
MTB30MM.SBK
MTB30NET.EXE
MTB30RED.DLL
MTB30REG.TXT
MTB30RUN.EXE
MTB30UTL.DLL
MTB30XTR.DLL
MTBOBJ.SBK
MTBPREFS.EXE
MTBSBKS.SBK
MTBXFER.TBK
NEWHOOK.BAT
ODBC1.TBK
PALED30.EXE
PALED30.HLP
PARADOX.ATS
PATCH.EXE
PATCH.RTP
PATCH1.TBK
PATHANIM.HLP
PCDLIB.DLL
PCDXBMP.DLL
PHOTO.DLL
PRINTWND.SBK
PRINTWRK.TBK
PXENGWIN.DLL
README.TXT
README.WRI
REFSHELF.EXE
RELNOTES.HLP
RELNOTES.WRI
RTA25056
RTB25056
RTP-DISK.ID
SCRNCAMP.EXE
SCRNCAMP.TXT
SCRWALK.ICO
SCRWALK.TBK
SPF.TBK
STUDENT.EXE
STUDENT.HLP
SYSINFO.EXE
TB30DB3.DLL
TB30DLG.DLL
TB30DOS.DLL
TB30PDX.DLL
TB30WIN.DLL
TB30WIN.TBK
TB30XTR.DLL
TBKDB3.DLL
TBKDLG.DLL
TBKFILE.DLL
TBKSHELF.EXE
TBKWIN.DLL
TBLOAD.EXE
TEMP.TBK
TEST.TBK
THUMB.SBK
UTILS.ATS
VAL.TBK
VEAMAA51.LEX
WAVEED30.EXE
WAVEED30.HLP
WINCOMT.DLL
WINCONST.HLP
WRAPBAR.DLL
WRKBNCHT.DLL
directories
directories
tbk_wid_name
PALTESTAHDW
ARNOLD
CTLOCAL
DEVUTIL
DSPUTIL
EXCEL
FLOWCHAR
IDAPI
INFOMDLR
MAILTMP
MDIABLTZ
MTB30
NECAUDIO
SECRETS
SYSINFO
TOOLBOOK
VIPER
WINDOWS
WINFAX
WINWORD
WSCAN
WSCANDATNSTVER
LISTHORZ
LOWPASS
MACROHLP
MAKEAPP
MCITEST
MEMORY
MIDIMON
MULTIPAD
MUSCROLL
MYPAL
MYSCRIB
OUTPUT
OWNCOMBO
OWNERB
PALETTE
PENCNTL
PENPAD
PRNTFILE
PROFILER
QWGDEMO
REVERSE
ROTARY
SELECT
SHOWDIB
SHOWGDI
SNOOP
SORTDEMO
SRVRDEMO
TDOSMEM
TIMERS
TOOLHELP
VERSTAMP
WINMEM32
WMFDCODE
XTENSION
LAURELM
HOURIR
BRIANT
CHARLESO
ERIKR
FRANKL
DICKE
BRUCEL
MIYUKIH
JOHNJ
SARAHV
TRANSFER
CHARLES
CHRISC
CHUCKW
CLAUDE
STEVEW
CATHYS
ALLANF
LENORAF
CRAIG
JOHNCO
DANNS
DARLENEM
DAVEH
KEVINB
LINDAA
DAWNM
DEBBIE
INGRIDF
DENNISO
STEVET
GIGIL
DOUGY
TERRYL
WHITEY
SCOTT
MIREIZ
LORIJ
CHARLESC
TAMMYH
AUSTRIA
MITCHELL
SWISS
SAVER
DENNISC
DOUGK
EPOCH
SCOTTM
MIKEF
GER_CPL
ELAINER
MELODY
JOHNGO
SCOTTSC
GREGE
HARRIETL
HARRYS
CSC_TOM
JACKIEV
MIKEN
JEAND
JEFFA
JOELK
JEFFU
JENNIFER
WHITNEYM
JEREANG
DICKH
JANETS
RANDYA
JOHNA
JOHNB
JOHNC
JOHNG
JOHNT
JONES
JORDANS
JOSEPHB
JOSHB
JULIE
KATHERIN
KEITHC
YVETTEB
DIDIERB
LANCE
LAURELC
LISAA
CSC_TAMY
LORIP
WAYNEW
MARCS
MARIEF
BETHR
MARKMA
MARTY
KIKIW
RICKS
BRIANH
MICHAELS
JEFFM
DEBBIEP
MIKEM
MOUSE
NADIMH
NANETTE
NORMS
PAULD
PAULG
PAULM
PHILP
LOGOS
DENNISL
RICKE
MICHELEC
DIANED
ROSSG
ROSSH
CHARLOTT
SCREENS
SHABBIR
LISAM
SARAHH
SHELLEYH
SHERRI
SHIRLEY
SHUANGL
SKUSALES
STEVEB
STEVEBA
STEVEBEC
STEVENW
SUSAND
SUSANM
SUZYS
MARKR
TERONU
TRACEY
TRAINING
TYLERB
SCOTS
WHOWHERE
WINNIE
TONYA
SUSANP
DAVIDS
SYPLUS
JOHND
DALEW
JENNW
JULIEP
BETHH
PRODUCTI
MIKES
MARGOTP
MICHAELO
STEVEC
JANETL
LYNNEP
TYRONEF
MIKEST
KRISTINE
BILLS
SANDYW
GAARL
MIKEP
BRADC
SUSANH
STEPHEN
STEVEF
Drives
Drives
tbk_wid_name
&Directories
D&rives
Fi&les
These Widgets have code that reads drive directory and file information from your hard drive.
TB40DOS.DLL Function Widgets.\
updateFileInfo
updateDirectoryInfo
selectFile
updateDirectoryInfo
updateFileInfo
enterPage
activateInstance
What does it
2550,5423
Postit4
2550,5567
Postit2
415,3597
Postit3
5300,3667
Postit1
What does it mean to link a DLL?
title
Because DLLs are accessed dynamically at runtime, Windows has no way of knowing which DLLs need to be accessed when the application launches. Windows waits for an application to instruct it as to which DLLs need to be loaded.
The process of attaching DLLs dynamically for an application to access is called linking. Windows keeps a table of the applications and the DLLs that are currently linked to them. To link DLLs from ToolBook, you use the LinkDLL structure. Chapter 12, "Using dynamic link libraries" in the OpenScript Reference Manual is an excellent resource for learning the basics of DLL use from ToolBook. We recommend that you read this chapter in conjunction with using this tips book.ook.ook..tips book.tips book..e of a program can link to different DLLs.
Several programs can link to a single DLL.o different DLLs.
Several programs can link to a single DLL.
Windows only keeps one copy of the DLL loaded no matter how many applications are using it.
popuptext
Memory Use
popTitle
Each running instance of a program can link to different DLLs.
Several programs can link to a single DLL.
Windows keeps only one copy of a DLL loaded no matter how many applications are using it.
To use functions from a DLL you must link them at runtime..
1440,-9346
LinkDLL control structure
2550,6575
Postit4
415,4605
Postit2
5300,4675
Postit3
1440,-8146
Postit1
LinkDLL control structure
title
In OpenScript, the linkDLL control structure is the mechanism for linking functions from a DLL. Because Windows sets up the attachment between the DLL and an application, any book opened in the same instance of ToolBook can use any functions linked since that instance was started. ed.
ink a DLL we need to call the unlinkDLL command. ToolBook will keep a DLL linked until unlinkDLL has been called the same number of times that the linkDLL structure block was ran.
NOTE: Among other things restore system will unlink all DLLs in the current instance of ToolBook.
A separate linkDLL control structure is needed for each instance of linking to a DLL.
popuptext
LinkDLL Structure
popTitle
--Example LinkDLL ControlStructure
linkDLL sysToolBookDirectory&"TB40WIN.DLL"
STRING getIniVar(STRING,STRING,STRING)
end LinkDLLLL
getIniVar
Registered Apps
ASYM.INI
Mtb40
tb40win.dll
getIniVar
buttonClick
buttonClick
--Find out where MTB
installed.
linkDLL systoolBookDirectory&"tb40win.dll"
STRING getIniVar(
"Registered Apps","Mtb40","ASYM.INI")
MTB Directory
""#f,[
95050919535738599103127501459
ASYM_TpID
Using DLLs Within ToolBook
title
Postit4
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit4
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit4"
720,105
offset
Postit4
3postit4
3Postit4
EnterPage
3Postit4
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit4
= Postit4
textUnderFlow
Forward
Postit2
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit2
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit2"
935,110
offset
Postit2
2postit2
2Postit2
EnterPage
2Postit2
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit2
= Postit2
textUnderFlow
Postit3
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit3
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit3"
745,40
offset
Postit3
%3Postit3
%3postit3
EnterPage
&3Postit3
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit3
= Postit3
textUnderFlow
notes
EnterPage
notes
UpdateDisplay
notifyAfter EnterPage
MainWindow
notes
enabled
notifyBefore UpdateDisplay
content text
Postit1
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit1
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit1"
630,45
offset
Postit1
]2Postit1
]2postit1
EnterPage
^2Postit1
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit1
= Postit1
textUnderFlow
EnterPage
leavePage
UpdateDisplay
reader
EnterPage
reader
leavePage
Aliasing DLL functions
2550,7871
Postit4
415,5901
Postit2
5300,5971
Postit3
1440,-6946
Postit1
Aliasing DLL functions
title
You may encounter two problems when linking to functions from DLLs. Functions linked from a different DLL may have the same name or may share a name with an OpenScript function.
Both of these problems can be solved by aliasing DLL functions in the linkDLL statement. By assigning an alias when declaring a DLL function you ensure two things resolve name conflicts and ensure readability.....ity.ity.
resolve name conflicts
readability
name conflicts
readability
ssssssssssssssssssssssss........................se you pick the usable name...................d.
OpenScript functions always take precedence over DLL functions.
popupText
A function declared with an alias may only be accessed via the alias name.
popupText
--Example LinkDLL Control Structure with alias
linkDLL sysToolBookDirectory&"TB40WIN.DLL"
STRING getSetupInfo = \
getIniVar(STRING,STRING,STRING)
end LinkDLL
Registered Apps
getIniVar
getSetupInfo
/getSetupInfo
ASYM.INI
Mtb40
tb40win.dll
buttonClick
buttonClick
--Find out where MTB
installed.
linkDLL systoolBookDirectory&"tb40win.dll"
STRING getSetupInfo = getIniVar(
+("Registered Apps","Mtb40","ASYM.INI")
MTB Directory
Unlinking DLLs
Unlinking DLLs
title
2550,7583
Postit4
415,5613
Postit2
5300,5683
Postit3
1440,-7246
Postit1
ToolBook keeps track of which DLLs have been linked, what aliases the functions have been assigned, and how many times a particular DLL has been linked. The number of times a DLL has been linked is called its reference count.
To unlink a DLL and free up the system resources used by the link, call unlinkDLL. When the unlinkDLL command is used, ToolBook decrements the reference count of the DLL indicated. If the reference count of the DLL reaches 0, ToolBook notifies Windows to destroy the link. To find out if a DLL has been removed, check the sysLinkedDLLs property after calling the unlinkDLL command.
SysLinkedDLLs returns a list of the DLLs currently linked to the instance of ToolBook.
popupText
tb40pdx.dll
Unlinking
Second Link of DLL
getPXuserInfo
First Link of DLL
buttonClick
buttonClick
Request "First Link
linkDLL systooLBookDirectory&"tb40pdx.dll"
STRING getPXuserInfo()
`Second
3fo()
csysLinkedDLLS
"Unlinking"
unlinkDLL "
UnLink Example
UnLink example button script.
to handle buttonClick
Request "First Link of DLL"
linkDLL sysTooLBookDirectory&"tb40pdx.dll"
STRING getPXuserInfo()
end
Request "Second Link of DLL"
linkDLL sysTooLBookDirectory&"tb40pdx.dll"
STRING getPXuserInfo()
end
while sysLinkedDLLS contains "tb40pdx.dll"
request "Unlinking"
unlinkDLL "tb40pdx.dll"
end
Windows v. OpenScript
2550,10319
Postit4
415,8349
Postit2
5300,8419
Postit3
1440,-4396
Postit1
Windows v. OpenScript data types
title
Windows and most Windows applications are developed in the C programming language. Therefore, all the documentation and information about Windows programming refers to data types for variables and parameters that are foreign to OpenScript. For a table which shows which Windows data types match to which OpenScript data types, refer to Chapter 12, "Using dynamic link libraries" in the OpenScript Reference Manual.
To the right is a reference to some of the common Windows data types. It is important to remember that the OpenScript data types are fewer in number than the Windows data types; one OpenScript data type can represent several different Windows data types.pes.pes...................................pe can represent several different Windows data typessss
C Programming Lanuage
popTitle
C and other programming languages are used to develop DLLs and other Windows programs.
popupText
WORD = Number from 0 to 65536
DWORD = Number from 0 to 4294967296
INT = Number from -32768 to 32768
LONG = Number from -2147483648 to 2147483648
POINTER = A 2-byte value which is an address of memory that contains data.
HWND = An access number into the Windows table that identifies a Window.
fies each Window.
that identifies each Window.
dows.
Handle
popTitle
While an HWND is the most common kind of handle we will use from ToolBook, there are several other handles that Windows uses. It's important to remember that each of these handles is a 2 byte value that represents a reference to an object in Windows.
popupText
Windows data types
Reference v. value
Reference v. value
title
2550,11903
Postit4
415,9933
Postit2
5300,10003
Postit3
1440,-2746
Postit1
With the unique exception of arrays, parameters in OpenScript functions are passed by value. However, there are some such DLL functions which require parameters to be passed by reference.
In order to pass data by reference to a parameter in a DLL function, the parameter must have access to the memory address containing the data. For this parameter, we simply pass a pointer (reference) to the address of the data. ta. ta. s a pointer (reference) to the address of the data. one using the OpenScript data type "POINTER".
R".
lows for changes to the datafunctions to make changes directly to the data. This is done using the OpenScript keyword "POINTER".
tly to the source data. d to pass the function a pointer to the data. That is
Passing a pointer to the data allows the functions to make changes directly to the source data.
Pass By Value
popTitle
Pass by value means that a copy of the data is made for the handler to work on. Changes to the value of a parameter are not reflected in the orginal variable or property passed to the handler. Literal strings (characters in quotes) can only be passed by value.
popupText
Pass by Reference
popTitle
Pass by reference means that the function is making changes directly to the variable passed to the function. Changes to the value of a parameter are reflected in the orginal variable passed to the function. Because properties of objects can only be set from within OpenScript, passing a property by reference does not change the property.
popupText
A case for pass by reference
When a function expects a buffer that means it needs a location to put data into.
Cases for pass by value
When a function expects a description or a value it expects a copy of the data.
In those cases where the documentation for a DLL function doesn't indicate parameter usage, be sure to find out how the function will be using the parameters before using it in OpenScript.
Nothing is more dangerous for your ToolBook application than an incorrectly used DLL function......d DLL function.
Rules of thumb
Pointer referencing
Pointer referencing
title
2550,11759
Postit4
415,9789
Postit2
415,9933
Postit3
5300,10003
Postit1
You can access global memory in OpenScript using the Pointer<TYPE>() functions. Because OpenScript has no internal ability to allocate global memory from Windows, this has to be done using the Windows Application Programming Interface (API).
The API is accessed by linking various Windows functions into the application. A more thorough discussion of the Windows API follows later in this book. For purposes of this example, only a couple of API functions needed. This script example comes from the Auto-Script library (ATS). By using Windows global memory allocation functions, memory can be allocated. Then this memory area, or buffer, can be accessed using the Pointer<TYPE>() functions.ons.ons.ons............, can be accessed by using the pointer<type>() functions..........n this memory area, or buffer, can be accessed by using the pointer<type>() functions.
Global Memory
popTitle
Windows keeps an internal table of memory segments that programs are using. If a program needs a memory segment, it requests the memory from the available (global) memory through the Windows API.
popupText
Example
The example above uses Windows API functions and the Pointer<TYPE> functions to build and use pointers. Although it is a simple example, it does show all the key elements needed to use pointers. Switch to Author level or right-click the button and press the
button to look at the script..pt..
1440,-2746
2550,11903
Common problems
2550,13199
Postit4
415,11229
Postit2
5300,11299
Postit3
1440,-1396
Postit1
Common problems
title
There are actually very few cases where you will run into problems using DLLs with ToolBook. But in those cases where a problem exists, the result can be severe. Most often, the system will generate a General Protection Fault (GPF).
The most common problems are functions declared with the wrong parameter list or called with the wrong parameter list.
These problems are usually solved by careful script additions, robust script comments, and accurate testing.............................ting..se problems are usually solved by careful script additions, robust commenting in the script, and accurate testing....
--Example LinkDLL Control Structure with alias
linkDLL sysToolBookDirectory&"TB40WIN.DLL"
STRING getSetupInfo = \
getIniVar(STRING,STRING,STRING)
end LinkDLL
--Example LinkDLL Control Structure with alias
linkDLL sysToolBookDirectory&"TB40WIN.DLL"
STRING getSetupInfo = \
getIniVar(INT,STRING,STRING)
end LinkDLLLLL
Incorrect Declaration
popTitle
Correct Declaration
Incorrect Declaration
In the incorrect example below the STRING parameter has been incorrectly declared as an INT.
<More info>
In this case ToolBook will most likely crash with a General Protection Fault (GPF) in TB40WIN.DLL because the DLL expects a pointer to a string but gets a number instead. When it tries to use the INT as a pointer, it will most likely try to access a piece of memory it shouldn't. Windows 3.1 reports invalid memory access with a GPF.
popupText
ToolBook system DLLs
2550,13919
Postit4
415,11229
Postit2
5300,12019
Postit3
1440,-646
Postit1
ToolBook system DLLs
title
Multimedia Toolbook uses several DLLs for its base system. This division of code amongst DLLs allows for three things
Modularity
Specialization
Improved performance
A modular application is easier to maintain, because it tends to have similar features grouped together. Developers can become experts in one module, which makes them better at solving problems in that module. Also, because Windows uses a virtual memory system that divides the code into segments, an application can use less RAM than it would require if all the code had to be loaded at once. e. e. ke all this possible....................................................... loaded at once.
DLLs make all this possible.
at once.
once.
equire if all the code had to be loaded at once.
FTS40ATR.DLL
FTS40IQA.DLL
FTS40IQR.DLL
FTS40MTB.DLL
FTS40RDR.DLL
FTS40RTF.DLL
FTS40SRT.DLL
FTS40UD0.DLL
FTS40UD1.DLL
FTS40UD2.DLL
MEDMANT.DLL
MTB40BAS.DLL
MTB40BMP.DLL
MTB40CMP.DLL
MTB40CVT.DLL
MTB40EDT.DLL
MTB40FLT.DLL
MTB40HIR.DLL
MTB40LNL.DLL
B40MM.DLL
MTB40RCA.DLL
MTB40RCR.DLL
MTB40RED.DLL
MTB40UTL.DLL
MTB40VBX.DLL
MTB40XTR.DLL
PALOPTX.DLL
PCDLIB.DLL
PCDXBMP.DLL
PHOTO.DLL
PXENGWIN.DLL
TB40DB3.DLL
TB40DLG.DLL
TB40DOS.DLL
TB40PDX.DLL
TB40WIN.DLL
WINCOMT.DLL
WRKBNCHT.DLL
MTB40MM.DLL
MTB40RCA.DLL
MTB40RCR.DLL
MTB40RED.DLL
MTB40UTL.DLL
MTB40VBX.DLL
MTB40XTR.DLL
PALOPTX.DLL
PCDLIB.DLL
PCDXBMP.DLL
PHOTO.DLL
PXENGWIN.DLL
TB40DB3.DLL
TB40DLG.DLL
TB40DOS.DLL
TB40PDX.DLL
TB40WIN.DLL
WINCOMT.DLL
WRKBNCHT.DLL
WRKBNCHT.DLL
MMTB 4.0 DLL List
2550,13775
415,11949
95050919535738599103127501459
ASYM_TpID
What DLLs come with ToolBook?
title
Postit4
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit4
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit4"
720,105
offset
Postit4
3postit4
3Postit4
EnterPage
3Postit4
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit4
= Postit4
textUnderFlow
Forward
Postit2
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit2
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit2"
935,110
offset
Postit2
2postit2
2Postit2
EnterPage
2Postit2
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit2
= Postit2
textUnderFlow
Postit3
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit3
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit3"
745,40
offset
Postit3
%3Postit3
%3postit3
EnterPage
&3Postit3
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit3
= Postit3
textUnderFlow
notes
EnterPage
notes
UpdateDisplay
notifyAfter EnterPage
MainWindow
notes
enabled
notifyBefore UpdateDisplay
content text
Postit1
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit1
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit1"
630,45
offset
Postit1
]2Postit1
]2postit1
EnterPage
^2Postit1
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit1
= Postit1
textUnderFlow
EnterPage
leavePage
UpdateDisplay
reader
EnterPage
reader
Add-On DLLs
Add-on DLLs
title
2550,14207
Postit4
415,12237
Postit2
5300,12307
Postit3
1440,-346
Postit1
Toolbook and Mutlimedia Toolbook ship with some specific add-on DLLs that provide additional functionality that is needed for some types of applications:
TB40DOS.DLL:provides access to DOS commands.
TB40WIN.DLL: provides access to common Windows functions.
TB40DLG.DLL: provides access to custom and common dialog boxes
TB40DB3.DLL:provides access to dbase III database files.
The Windows Application Programming interface (API) is a set of DLLs that contain all the functions that control Windows. There are literally hundreds of functions in the Windows API. A couple of functions that ToolBook developers find helpful include FindWindow(), which returns the handle to any window given a caption or class name and ShowWindow(), which sets the state of another window given its window handle. The Windows API contains some very obscure functions such as PrestoChangoSelector(), which you will never use with ToolBook. The Windows API is composed of three main DLLs: USER, KERNEL, and GDI. The complete Windows API is available to ToolBook via the linkDLL control structure. re.
Caption
popTitle
The text of the window's title bar.
popupText
Class name
popTitle
A unique string that identifies a particular application. All ToolBook windows are identified by the same class name.
popupText
USER, KERNEL, and GDI
popTitle
These are module names rather than actual DLL file names. For standard Windows API calls, it's best to use the module name rather than the actual file name to ensure the correct file is loaded.
popupText
KERNEL
Section List
Contains all user-interface and windowing functions
Section List
Contains all user-interface and windowing functions.
Section List
Contains functions that control memory management, loading and executing programs, and scheduling.
Section List
Contains all graphics functions.
5300,-1373
1440,-14596
95050919535738599103127501459
ASYM_TpID
What is the Windows API?
title
Postit4
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit4
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit4"
720,105
offset
Postit4
3postit4
3Postit4
EnterPage
3Postit4
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit4
= Postit4
textUnderFlow
Forward
Postit2
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit2
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit2"
935,110
offset
Postit2
2postit2
2Postit2
EnterPage
2Postit2
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit2
= Postit2
textUnderFlow
Postit3
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit3
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit3"
745,40
offset
Postit3
%3Postit3
%3postit3
EnterPage
&3Postit3
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit3
= Postit3
textUnderFlow
notes
EnterPage
notes
UpdateDisplay
notifyAfter EnterPage
MainWindow
notes
enabled
notifyBefore UpdateDisplay
content text
Postit1
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit1
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit1"
630,45
offset
Postit1
]2Postit1
]2postit1
EnterPage
^2Postit1
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit1
= Postit1
textUnderFlow
EnterPage
leavePage
UpdateDisplay
reader
EnterPage
leavePage
reader
Using the Windows
2550,671
Postit4
2550,815
Postit2
2550,959
Postit3
415,-1011
Postit1
Using the Windows API
title
Just as ToolBook links to its own DLLs, ToolBook can connect to the DLLs that compose the Windows API. In fact, given the DLL name and the proper function declaration, any DLL function can be used with ToolBook. However, like any other DLL function, you need to make certain the function is declared properly. Errors in function declarations can lead to unpredictable results. To the right are some useful functions and the DLLs that contain them. The actual function declarations can be found in the Windows API Help File, WIN31WH.HLP located in the WINAPI directory below the MTB40 directory. Remember when using these functions, it's a good idea to alias your functions to avoid breaking another ToolBook application's script.
KERNEL
SHELL
FindWindow()
ShowWindow()
ExitWindows()
MoveWindow()
Winhelp()
indow()
GlobalAlloc()
GlobalLock()
GlobalUnlock()
GlobalFree()
GetDC()
ShellExecute()
GlobalFree()
GetFreeSystemResources()
GetProcAddress()GlobalFree()
LockWindowUpdate()
GetSystemMetrics()
GetDesktopWindow()
LockInput()
ShowCursor()
Useful functions
5300,-941
1440,-14146
Using pointers to
Using pointers to structures
title
2550,1679
Postit4
415,-291
Postit2
5300,-221
Postit3
1440,-13396
Postit1
There are some DLL functions in the Windows API that take a pointer to a structure as a parameter. A structure is a derived data type in C for which ToolBook has no equivalent. Therefore, it can be tricky to use DLL functions that require structures. It is possible, however, to build structures in ToolBook that can be passed to a DLL. The first step is to create a block of global memory as large as the structure using the tbk_getWinPointer() ToolBook function discussed earlier. Before you can populate a memory buffer, you need to know how the structure is designed and how large each element is. Once this is known, populating the structure is done using the Pointer<TYPE> functions discussed earlier. To the right is a list of data types and their size in bytes.tes.ir size in bytes......{
Structures
popTitle
Structures in C are user-defined types that allow grouping of various data types into a single object.
popupText
DOUBLE
DWORD
FLOAT
POINTER
STRING
String
popTitle
Memory used by a string depends on the size of the string.
popupText
22222
Data Type
sing pointers to
Using pointers to structures (cont.)
title
2550,2543
Postit4
415,573
Postit2
5300,643
Postit3
1440,-12496
Postit1
Populating a structure with the Pointer<TYPE> functions is simple once you know the makeup of the structure. For example, a structure composed of a FLOAT, a WORD, and a DWORD is filled in the following manner:
get pointerFLOAT (0,pMem, floatVal)
get pointerWORD (4,pMem, wordVal)
get pointerDWORD (6,pMem, dwordVal)
This fills a memory buffer, pMem, with three values at three different offsets. Each member of the memory buffer is given exactly enough room for its type and the buffer is 0-indexed. For instance, the FLOAT is given exactly 4 bytes of space. To the right is an example that returns the dimensions of this window by calling the API function GetWindowRect(). This function requires a pointer to a RECT structure.re................tructure.
popTitle
This is the return value from tbk_getWinPointer().
popupText
floatVal
popTitle
This is a variable set to the value you would place into the structure.
popupText
RECT structure
popTitle
A RECT structure in Windows is a a structure that consists of 4 integer values (2 bytes) that compose the X,Y coordinates for the upper left and lower right corners of a given object.
popupText
-#, #>
-#, #>
-#, #>
-#, #>
GetWindowRect
,CTi4O
r1tbk_FreeWinPointer
Dimensions of this window are:
y[GetWindowRect
explanation
tbk_getWinPointer
buttonClick
buttonClick
Zpoint pMem
linkDLL user
INT GetWindowRect (WORD, POINTER)
-- create
Ibuffer.
Enough
4 INTs.
f = tbk_getWinPointer(8)
jwindowHandle
"Dimensions
eare: " \
& pointerINT(0,
) & "," &
) & "," & \
) & "," &
-- always remember
free memory
done.
tbk_FreeWinPointer(
"explanation"
Get Window dimensions
explanation
leavePage
notifyAfter
Using this function on the main window is unnecessary because the bounds property of any viewer does the same thing as the GetWindowRect() function. However, this function is the only way to get the bounds of a non-Toolbook window. get the bounds of a non-ToolBook window, this function is the only way to do it.on is the only way to do it.
leavePage
What is it
2550,383
Postit4
415,-1587
Postit2
5300,-1517
Postit3
1440,-14596
Postit1
What is it for?
title
Like Windows, the ToolBook system is event-driven. In fact, ToolBook is very tightly integrated with Windows. Messages processed by Windows and not served by any built-in ToolBook message can be intercepted and handled via the translateWindowMessage control structure. An example of a Windows message not handled by ToolBook internally is the WM_ACTIVATE message. The ToolBook message activateInstance, based on WM_ACTIVATE, is sent only when the ToolBook window is activated or deactivated. The button to the right invokes a script that changes the caption of this window when it is deactivated.ted.........ption of this window when it is deactivated.......... deactivated.
WM_ACTIVATE
popTitle
This is the Windows message sent when a window is activated as well as when it is deactivated.
popupText
untranslate
Set caption on deactivate
leaveInstance
Restore
buttonClick
Extending toolBook
Disabled
leaveInstance
untranslate
leavePage
untranslate
buttonClick
<> "Restore"
WM_ACTIVATE = 0x0006
untranslate
translateWindowMessage
windowHandle
on
leaveInstance
= "Set
IhWnd, wmsg, wp
wp > 0
e= "Extending toolBook"
e= "Disabled"
notifyAfter
X0006
untranslateWindowMessage
Restore
Click the button above. Then click on another program, like Program Manager, and watch the ToolBook caption..n.....................................
leavePage
untranslate
reader
reader
leavePage
95050919535738599103127501459
ASYM_TpID
Using translateWindowMessage
title
Postit4
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit4
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit4"
720,105
offset
Postit4
3postit4
3Postit4
EnterPage
3Postit4
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit4
= Postit4
textUnderFlow
Forward
Postit2
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit2
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit2"
935,110
offset
Postit2
2postit2
2Postit2
EnterPage
2Postit2
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit2
= Postit2
textUnderFlow
Postit3
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit3
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit3"
745,40
offset
Postit3
%3Postit3
%3postit3
EnterPage
&3Postit3
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit3
= Postit3
textUnderFlow
notes
EnterPage
notes
UpdateDisplay
notifyAfter EnterPage
MainWindow
notes
enabled
notifyBefore UpdateDisplay
content text
Postit1
keyUp
enterRecordField
>= ""
VFalse
offset
ButtonStillDown
offset
offset
buttonDown
Postit1
buttonclick
ButtonStillDown
oPosition
buttonclick
J"Postit1"
4'F'{
630,45
offset
Postit1
]2Postit1
]2postit1
EnterPage
^2Postit1
leavePage
keyUp
notifyBefore EnterPage
textoverFlow
postit1
= Postit1
textUnderFlow
EnterPage
leavePage
UpdateDisplay
EnterPage
Things to watch
Things to watch for
title
5300,-2669
Postit4
415,-3891
Postit2
2550,-913
Postit3
2550,-769
Postit1
The translateWindowMessage control structure is a powerful method for further controlling the behavior of your ToolBook applications. It should be used with caution because of the many different types of messages in Windows. Unless you fully understand how a message works, do not attempt to trap or handle it. If you do decide to experiment with this feature, make sure you save your work or test your handler in a blank instance of ToolBook first. Also, make sure there is not already a ToolBook message that you could handle first. Finally, when you do use translateWindowMessage, be sure to untranslate that message when it is no longer needed by using untranslateWindowMessage. You can either untranslate a single message or all messages for a given window.dow....
-- untranslate a single message
untranslateWindowMessage 0x0006 \
for windowHandle of this windowwHandle of this windowindow
-- untranslate all messages
untranslateAllWindowMessages for \
windowHandle of this windowdowndow
Yes, this is the longest keyword in OpenScript.
popupText
415,-2739
1440,-15946
TmpltTool
Title Page
title
ASYM_BeenHere
V, #>
A AlreadySized
updateDisplay
A AlreadySized
leavePage
notifyafter updateDisplay
4AlreadySized
Zxsize,ysize
xSize =
/- (1440/10)
l&","&
oPosition = 1440/20&","&1440/20
removeBookMark
i#gotoBookMark
ButtonClick
ButtonClick
gotoBookMark
Go to Book Mark
popHelpText
addBookMark
&eBookMark
buttonClick
1, "@
nomark
bookMarks
updateDisplay
buttonClick
BookMark
notifyAfter updateDisplay
bookMarks
onormalGraphic = icon "mark"
#on "nomark"
Add Book Mark
popHelpText
8notePad
buttonClick
buttonClick
notePad
Note Pad
popHelpText
w, #?
title
updateDisplay
notifyAfter updateDisplay
ZoldLock
= lockScreen
J" =
title
--
--
<> NULL
& ":" &&
otextoverFlow < 1
Extending ToolBook
(postit
buttonClick
buttonClick
postit
Post Notes
pophelpText
Table of Contents
buttonClick
buttonClick
MainWindow
"Table
Contents"
Table of Contents
popHelpText
updateDisplay
leavePage
95050919534438586212124501368
ASYM_TpID
TutorialList
ASYM_BeenHere
Rebuild
buttonClick
buttonClick
&Rebuild
bottomLine
Cancel
TutorialList
buttonClick
buttonClick
isOpen
"TutorialList"
close
&Cancel
Rebuild
tutorialList
&Cancel
&Rebuild
TutorialList
I can't find the tutorial book
File Not Found
buttonClick
buttonClick
4tutorialList[][]
selectedTextLines
"TutorialList"
8(path
][2])
c"File Not Found"
][2])
"I can't find the
f"&Cancel"
"&Rebuild"
isOpen
close
&Go To
ThreeDeeRect
out,sculpted
TutorialList
tempFileinfo
tutorialList
TutorialList
getInivar
tutorial.ini
enterpage
notifyBefore
4tutorialList[][]
counter
Ztempfile
tempFileinfo = getInivar("TutorialList",
D,path
h.ini")
ctempFileInfo <> ""
W) = 2
][1] =
][2] =
dimensions(
i][1] &CRLF
--Clear off the extra
topLine
enterpage
PopText
95050919593838940058139359890
ASYM_TpID
Notepad
ASYM_BeenHere
out,sculpted
ThreeDeeRect
Notes
Notes
Notepad
notes
enterPage
keyChar
enterField
NotifyBefore
MainWindow
"Notes"
"Notepad" = notes
key,isShift,isCtrl
keyEnter
buttonClick
bottomLine
topLine
Notes
notes
Notepad
PupdateDisplay
buttonClick
buttonClick
MainWindow
notes
"Notes"
"Notepad"
updateDisplay
isOpen
close
&Save
Cancel
Notepad
buttonClick
buttonClick
isOpen
"Notepad"
close
&Cancel
Reset
Notes
Notepad
notes
buttonClick
buttonClick
MainWindow
"Notes"
"Notepad" = notes
&Reset
enterPage
Notepad
9505091959443894531416471984
ASYM_TpID
PopHelp
ASYM_BeenHere
ShowText
1,"JdY
1,"J2Y
updateDisplay
notifybefore updateDisplay
= 1440/14 *
)-1,1440/5
otextoverFlow > 10
Table of Contentss one copy of the DLL loaded no matter how many applications are using it.vailable for content.